package 泛型2;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * @author Administrator
 * @ClassName PersonTest
 * @TIME 星期二 2020/12/29
 */
public class PersonTest {
    public static <Person> void main(String[] args) {
        Collection<Person> collection = new ArrayList<>();
        collection.add((Person) "Liu");
        collection.add((Person) "LI");
        collection.add((Person) "HAN");

        Iterator iterator = collection.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());

        }
        iterator.remove();
        System.out.println("__________________");
        for (Person str : collection){
            System.out.println(str);
        }
    }
}
